<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
<%@ include file="../Connections/A146240Connection.jsp" %>
<%
Driver DriverRecordset1 = (Driver)Class.forName(MM_A146240Connection_DRIVER).newInstance();
Connection ConnRecordset1 = DriverManager.getConnection(MM_A146240Connection_STRING,MM_A146240Connection_USERNAME,MM_A146240Connection_PASSWORD);
PreparedStatement StatementRecordset1 = ConnRecordset1.prepareStatement("SELECT * FROM A152786.PRODUCT ORDER BY PRODUCT_ID ASC");
ResultSet Recordset1 = StatementRecordset1.executeQuery();
boolean Recordset1_isEmpty = !Recordset1.next();
boolean Recordset1_hasData = !Recordset1_isEmpty;
Object Recordset1_data;
int Recordset1_numRows = 0;
%>
<%
int Repeat1__numRows = 10;
int Repeat1__index = 0;
Recordset1_numRows += Repeat1__numRows;
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" type="text/css" href="productStyle.css" />
<title>Untitled Document</title>
<!--Javascript-->
<script type="text/javascript">
	function changeDisplay(imageName,price,description){
		var obj = document.getElementById('display_content');
		var imgTag = "<img src='../productImages/"+imageName+".gif' width='80px' height='158px' /><br><br><center>"+imageName+"</center><br> Price : "+price+"<br> Description : "+description;
		obj.innerHTML = imgTag;
		return;
	}
	function disableRange(check){
		if(check){
			document.searchForm.rangeBelow.disabled=true;
			document.searchForm.rangeUpper.disabled=true;
		}else{
			document.searchForm.rangeBelow.disabled=false;
			document.searchForm.rangeUpper.disabled=false;
		}
		return;
	}
</script>
</head>

<body>
<div id="main_content">

<div id="browse_content">
<TABLE cellpadding="15" border="0">
  <% 
  	String firstResultString=null;
  	boolean colZeroCheck=true;
	boolean firstResult=true;
  	while ((Recordset1_hasData)&&(Repeat1__numRows-- != 0)) { 
  		if(firstResult){
				firstResultString="<img src=\"../productImages/"+
				(((Recordset1_data = Recordset1.getObject("PRODUCT_NAME"))==null || Recordset1.wasNull())?"":Recordset1_data)+
				".gif\" width=\"80px\" height=\"158px\"/><br><br><center>"+(((Recordset1_data = Recordset1.getObject("PRODUCT_NAME"))==null || Recordset1.wasNull())?"":Recordset1_data)+
				"</center><br> Price : RM"+(((Recordset1_data = Recordset1.getObject("PRODUCT_PRICE"))==null || Recordset1.wasNull())?"":Recordset1_data)+
				"<br> Description : <pre>"+(((Recordset1_data = Recordset1.getObject("PRODUCT_DESC"))==null || Recordset1.wasNull())?"":Recordset1_data)+"</pre>";
				firstResult=false;	
		}
		if(colZeroCheck){
				out.println("<TR>");
				out.println("<TD>");
				out.println("<center><a href=\"#\" onClick=\"changeDisplay('"+(((Recordset1_data = Recordset1.getObject("PRODUCT_NAME"))==null || Recordset1.wasNull())?"":Recordset1_data)+
				"','RM"+(((Recordset1_data = Recordset1.getObject("PRODUCT_PRICE"))==null || Recordset1.wasNull())?"":Recordset1_data)+
				"','<pre>"+(((Recordset1_data = Recordset1.getObject("PRODUCT_DESC"))==null || Recordset1.wasNull())?"":Recordset1_data)+
				"</pre>');\"><img src=\"../productImages/"+(((Recordset1_data = Recordset1.getObject("PRODUCT_NAME"))==null || Recordset1.wasNull())?"":Recordset1_data)
				+".gif\" width=\"80px\" height=\"158px\"/><br>"+(((Recordset1_data = Recordset1.getObject("PRODUCT_NAME"))==null || Recordset1.wasNull())?"":Recordset1_data)+
				"<br>RM"+(((Recordset1_data = Recordset1.getObject("PRODUCT_PRICE"))==null || Recordset1.wasNull())?"":Recordset1_data)+"</a></center>");
				out.println("</TD>");
				colZeroCheck=false;
		}else{
				out.println("<TD>");
				out.println("<center><a href=\"#\" onClick=\"changeDisplay('"+(((Recordset1_data = Recordset1.getObject("PRODUCT_NAME"))==null || Recordset1.wasNull())?"":Recordset1_data)+
				"','RM"+(((Recordset1_data = Recordset1.getObject("PRODUCT_PRICE"))==null || Recordset1.wasNull())?"":Recordset1_data)+
				"','<pre>"+(((Recordset1_data = Recordset1.getObject("PRODUCT_DESC"))==null || Recordset1.wasNull())?"":Recordset1_data)+
				"</pre>');\"><img src=\"../productImages/"+(((Recordset1_data = Recordset1.getObject("PRODUCT_NAME"))==null || Recordset1.wasNull())?"":Recordset1_data)
				+".gif\" width=\"80px\" height=\"158px\"/><br>"+(((Recordset1_data = Recordset1.getObject("PRODUCT_NAME"))==null || Recordset1.wasNull())?"":Recordset1_data)+
				"<br>RM"+(((Recordset1_data = Recordset1.getObject("PRODUCT_PRICE"))==null || Recordset1.wasNull())?"":Recordset1_data)+"</a></center>");
				out.println("</TD>");
				out.println("</TR>");
				colZeroCheck=true;
		}
  Repeat1__index++;
  Recordset1_hasData = Recordset1.next();
}
if(!colZeroCheck){
			out.println("</TR>");
		}
%>
</table>
</div>
<div id="display_content"><%
	out.println(firstResultString);
%></div>
</div>
</body>
</html>
<%
Recordset1.close();
StatementRecordset1.close();
ConnRecordset1.close();
%>
